package com.teamclub.erp.scontrollers

import com.teamclub.app.sforms.AppDomainInstanceForm
import com.teamclub.app.sservices.systemmanager.AppDomainInstanceService
import com.teamclub.util.libs.Eithers
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.{PostMapping, RequestBody, RequestMapping, RestController}

@RestController("com.teamclub.erp.scontrollers.DealerInfoController")
@RequestMapping(Array("/erp/dealerinfo"))
class DealerInfoController {

  @Autowired
  var appDomainInstanceService: AppDomainInstanceService = _

  @PostMapping(Array("add"))
  def add(@RequestBody form: AppDomainInstanceForm) = {
    form.appDomain = "WINDER-DEALER"
    Eithers.toJson(appDomainInstanceService.add(form))
  }

}
